<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/1/10/0010
 * Time: 11:19
 */

namespace app\sports_admin\model;


use think\Model;

class DissertationType extends Model
{
    protected $table = 'dissertation_type';

    protected $pk = 'id';

    protected $autoWriteTimestamp = true;


    //获取分类
    public static function getDissertationTypeList()
    {
        return self::field('id,title,parent_id,path,concat(path,id)as type')->order('type')->select();
    }
    /**
     * 查询是否有子类
     */
    public static function getTypeChild($id)
    {
        return self::field('id,path,title,concat(path,id) as type,parent_id')->where('parent_id',$id)->find();
    }
    /*
     * 查询某个类别信息
     * @param $id 类别信息id
     */
    public static function findTypeInfo($id)
    {
        return self::where('id',$id)->find();
    }
    /*
     * 添加类别信息
     * @param $input 类别信息
     */
    public static function insertTypeInfo($input)
    {
        return self::create($input);
    }
}